home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Tampa Bay Amiga Group
/
TBAG - Tampa Bay Amiga Group's Disk of the Month #60 (1991)(Merlin's Software - Amiganuts United)(PD).zip
/
TBAG - Tampa Bay Amiga Group's Disk of the Month #60 (1991)(Merlin's Software - Amiganuts United)(PD).adf
/
Docs
/
WordSearch.Docs
< prev
next >
Wrap
Text File
|
1991-09-20
|
7KB
|
177 lines
Wordsearch Generator
This is an automated wordsearch generator which supports puzzle sizes
limitted (by defines) to 1000X1000 and up to 50 words.
Words orientations can be limitted to any subset of the eight primary
directions and the puzzle can be rotated or flipped.
It has a spartan but functional user interface highlighted by the
req.library and can output the word list, key and puzzle to file or prt:.
The system default font under WB 2.0 is supported for the puzzle window.
If you've ever tried to create a simple wordsearch you know the hardest
part is getting past staring at a blank page. So I wrote this program
to randomly place words within a puzzle.
It works by generating a first placement and then sequentially moving
through the puzzle until the word fits. Once a fit is found it goes
to the next word. If a fit cannot be made the previous word is attempted
to be refitted and if it cannot then it steps back to the word before it.
Therefore a complex puzzles may seem to take forever but given
enough time it will always determine if the words can be fit.
Because forever is a long time I've added a requestor to abort the algorithm.
Things to consider when running the program:
-Boost the stack: 4000 won't cut it for even very simple puzzles.
If the stack isn't large enough the program shouldn't crash but
it will shut down leaving the windows to clutter your workbench.
ei Stack 20000
-Use FastFonts (FF on Wb1.3) or the text scrolling will be abominal.
-If you have 2.0 try changing the system default text to something larger.
This will effect the Puzzle display window so you can make the puzzle large
enough to fill the WB screen and then use GraphicDump to print the puzzle.
I prefer printing with a DTP but this is a good poor man's solution.
Hopefully the product IS intuitive so I'll just explain the general
operation and the menus. The speed of the interface also needs
improvement but for now its useable.
The Wordlist Window:
Here you enter your words.
Click in the window and you'll see a cursor appear so you can enter a
word.
Hitting return will push you down to the next line for entering another word.
Note: this occurs even if the next word is below the bounds of the window
The scroll bar at the side of the window lets you change the view of the
word list.
If you need to edit an entry just click where you want to change and use
the delete or backspace or any of the special editing available with
Intuition string gadgets.
There is also a menu for some more sophisticated editing of the wordlist
which will be discussed later.
The Puzzle Window:
Here the last generated key or puzzle is displayed.
If the puzzle is larger than the window the scroll bars at the bottom and
right side can be used to scroll about.
What is displayed is controlled by a menu which will be discussed later.
(Is it later already?)
The Menus:
Project - controls printing and saving/loading a puzzle and wordlist
New - clear the wordlist
Open - load a saved file
will call up a file requestor
Save - save under the current file name
if a file name has not been set the requestor will come up
Save As - bring up requestor to change save filename and save the file
Print - text dump of the wordsearch
Wordlist - prints the wordlist as it appears in wordlist window
default output is to PRT: See Print Redirect
Display - prints the display as it appears in the puzzle window
default output is to PRT: See Print Redirect
Print Redirect
To File - if active, will bring up requestor for where
to print the output when a print options is selected
To Clipboard - not implemented (yet)
Puzzle - controls generation of new puzzle information
Dimensions - set the dimensions of the puzzle via requestors
a new key and puzzle will be generated automatically
Generate
New Key - recreate the puzzle from the ground up
New Puzzle - only replace the filler the goes around words
Try to Overlap - if active New Key will try to position words
so they are tightly overlapped
Word Direction - How words can be positions in the puzzle
Left - only left to right
Left Down etc
Down
Right Down
Right Up
Up
Left Up
Display - controls how the puzzle is displayed
Key - display the key, only the letters placed from the wordlist
are displayed
Puzzle - display the key plus filler to hide the words
Direction - the puzzle/key can be fliped and rotated 90 degrees
the signs indicate if the puzzle is flipped along that axis
and the order indicates the horizontal and vertical axis of
the display
+X+Y - display as generated
+X-Y
-X+Y - reverse the direction of the x axis
-X-Y
+Y+X - width along the vertical and height along horizontal
+Y-X
-Y+X
-Y-X
Wordlist - some manipulation commands for the word list
acts on the word active before selecting the menu
To Buffer - copy the word to a temporary storage buffer
there is only one word stored in the temporary storage
From Buffer - copy to the word from the buffer to the active word
Insert - make room for a word at the current location
Delete - delete the current word moving all subsequent words up
Clean Up - remove any blank words
Uppercase All - convert all words to uppercase
puzzle is not affected so use this before you New Key
Sort - sort words alphabetically
Well that's it accept for the generic disclaimer that I'm not responsible for
anything which results from you running this program, good or bad.
The program IS public domain since I feel it can be seriously improved
speed wise and I probably will not get around to working on it for a while.
As such I've included the source, in C.
I've also included the source for reqglue.o from the ReqLib package which has
one function added so the default font height and width can be be retrieved
easily in a C program. To recompile you'll also need the programmer kit for
the req.library available on fish.
Compiled under Lattice 5.04.
Thanks to Anders Bjerin for putting together the C Manual on Fish
which gave me the courage to attempt the intuition interface, Colin Fox and
Bruce Dawson for my favorite requestor library, and to any and all in the
AMiga Users of Calgary who I've annoyed with programming questions
particularly resident guru Stephen Vermeulen.
Craig Lever
RR #1,
Airdrie, Alberta, CAN
T4B 2A3
Fidonet:
Craig Lever @ 1:134/27, AMUC Express (Calgary Alta) (403) 282-5137
282-5171
282-5224
282-5238
@ 1:134/13, The SuperBox BBS (Calgary Alta) (403) 288-0531
288-2396